home *** CD-ROM | disk | FTP | other *** search
- Reprinted from: Micro/Systems Journal, Volume 1. No. 4. Sep/Oct 1985
- -----------------------------------------------------------------
- Copy of back issue may be obtained for $4.50 (foreign $6) from:
- Subscriptions are $20/yr, $35/2yrs domestic (published bimonthly)
- Micro/Systems Journal
- Box 1192
- Mountainside NJ 07092
- -----------------------------------------------------------------
- Copyright 1986
- Micro/Systems Journal, Box 1192, Mountainside NJ 07092
- This software is released into the public domain for
- non-commercial use only.
- -----------------------------------------------------------------
-
- The C Forum
-
- by Don Libes
-
- The 1985 Obfuscated C Code Contest
-
- In previous columns I discussed C programming techniques by
- providing examples that are educational. By that I mean that the
- code is readable, easily-modifiable, portable, modular, well-
- commented, structured, etc. I like to think of such well-written
- code as "elegant". Such programs should be a pleasure to read.
- However, not everyone writes "beautiful" code, and I would be
- amiss in my duties as an educator to ignore that fact.
- Normally we don't consider it worthwhile to publish "ugly"
- or unreadable code, but there are some examples that one can
- actually learn by (much as I learned that a red flame was hot
- when I stuck my hand in it).
- Thus, it is with much pleasure (and a big grin - see picture
- above) that I announce the 1985 Obfuscated C Code Contest. This
- contest is run by Landon Noll who collects the entries and then
- wonders about how much thought the author must have put into
- destroying an otherwise good piece of code. Landon says,
-
- The contest was motivated by reading some Unix source code
- (it was /etc/config from 4.2BSD). I was shocked at how much
- simple algorithms could be made cryptic, and therefore useless,
- by a poor choice of code style. "Could someone be proud of this
- code?"
-
- ENTERING THE CONTEST
- The 1985 contest is now open. The goal is to write the most
- obscure C program within the rules below:
-
- 1) The source must be 512 bytes or less.
- 2) Mail your entries to:
- Landon Noll
- 3770 Flora Vista Ave. #705
- Santa Clara CA 95051
- or, via Usenet: ...!ihnp4!nsc!chongo
- or, mail them to Micro/Systems Journal and we will forward
- them to Landon.
- 3) Include at the top of the letter:
- a) Your name and address. If you want your entry to be
- anonymous, indicate this.
- b) A brief statement of what the program should do.
- c) The machine, OS and C compiler on which it runs.
- 4) Enclose your source between the following lines:
- ---start of program---
- <place obfuscated source here>
- ---end of program---
- 5) The C program must be written in common C. That is, K&R
- plus common extensions.
- 6) The program must be of original work.
- 7) The program must be a complete program. (i.e., not just a
- fragment)
- 8) Entries must be received on or before September 31, 1985.
-
- GUIDELINES
- Each entry will be judged for its non-clarity. I will
- attempt to run each of them on a Vax 780/4.2BSD system. Don't
- let the lack of such a system stop you! Try to avoid operating
- system/machine specific code if you do not have such a system.
- Extra points will be given to programs that:
- a) pass lint without complaint.
- b) actually do something interesting (not just exit).
- c) are portable (i.e., no special calls of local features). Long
- variable names will be allowed as needed.
-
- Let me point out that the guidelines for this year give more
- credit to lint/machine independent solutions. Thus the winner
- for 1984 would not be rated as high under this year's rules.
- Good luck!
-
- 1984 OBFUSCATED C CODE CONTEST WINNERS
- The following are the top four entries from last year's
- contest. Please read them carefully. If you think you
- understand one, you've probably glanced at it too quickly. These
- programs are the most bizarre examples of C code that I've ever
- seen. (Yes, they're much worse than the UNIX sources.)
- Amazingly, they all work.
- They're not just good for a laugh. Each one is good for
- hours of study. Not only do they show you what NOT to do, but
- they teach you how to deal with very strange code. Lastly, you
- can actually learn some of the finer points of C by studying
- these very unusual programs.
-
- <DIS>HONORABLE MENTION FOR 1984:
- ------------------------------------------------------------
-
- ------------------------------------------------------------
- AUTHOR: anonymous
- COMMENT: Too embarrassed that s/he could write such trash, I guess.
-
- THIRD PLACE FOR 1984:
- ------------------------------------------------------------
-
- ------------------------------------------------------------
- AUTHOR: Mike Laman
- UUCP: {ucbvax,philabs,sdccsu3,sdcsla}!sdcsvax!laman
- COMMENT: Accepts one positive argument. Try something like "cmd
- 37".
-
- SECOND PLACE AWARD FOR 1984:
- ------------------------------------------------------------
-
- ------------------------------------------------------------
- AUTHOR: Dave Decot
- UUCP: hplabs!hpda!hpdsd!decot
-
-
- FIRST PLACE AWARD FOR 1984:
- ------------------------------------------------------------
-
- ------------------------------------------------------------
- AUTHORS: Sjoerd Mullender, Robbert van Renesse
- ADDRESS: Vrije Universiteit, Amsterdam, the Netherlands.
- UUCP: decvax!mcvax!vu44!{sjoerd,cogito}
- COMMENT: Try this on your local VAX or pdp-11.